package com.pingao.mp.modular.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 菜单表 
 * </p>
 *
 * @author 闻品高
 * @since 2018-09-26
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("sys_menu")
public class Menu extends Model<Menu> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 菜单名称
     */
    private String name;

    /**
     * 模块名称
     */
    private String moduleName;

    /**
     * 控制器名称
     */
    private String actionName;

    /**
     * 方法名称
     */
    private String functionName;

    /**
     * 创建人
     */
    private Integer userId;

    /**
     * 父级菜单,默认根菜单
     */
    private Integer parentId;

    /**
     * 是否显示在菜单上（0：不显示在菜单上，1：显示在菜单上。默认显示在菜单上）
     */
    private Integer isMenu;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 删除时间
     */
    private LocalDateTime deleteTime;

    /**
     * 菜单图标
     */
    private String icon;

    /**
     * 排序
     */
    private Integer sort;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    /**
     * 是否有子菜单
     */
    @TableField(exist = false)
    private boolean hasChild;


    /**
     * 某个角色是否具有该菜单的权限
     */
    @TableField(exist = false)
    private boolean hasPermission;
    /**
     * url
     */
    @TableField(exist = false)
    private String url;


    public static final String COL_ID = "id";

    public static final String COL_NAME = "name";

    public static final String COL_MODULE_NAME = "module_name";

    public static final String COL_ACTION_NAME = "action_name";

    public static final String COL_FUNCTION_NAME = "function_name";

    public static final String COL_USER_ID = "user_id";

    public static final String COL_PARENT_ID = "parent_id";

    public static final String COL_IS_MENU = "is_menu";

    public static final String COL_CREATE_TIME = "create_time";

    public static final String COL_UPDATE_TIME = "update_time";

    public static final String COL_DELETE_TIME = "delete_time";

    public static final String COL_SORT = "sort";

    public static final String COL_ICON = "icon";
}
